public class demo02 {
    public static void main(String[] args) {
        int count=0;
        for (int i = 2022; i <= 2022222022; i++) {
            String str=i+"";
            if(check(str)){
                count++;
            }
        }
        System.out.println(count);
    }
    public static boolean check(String str){
        char[] arr=str.toCharArray();
        int left=0;
        int right=arr.length-1;
        while (left<right){
            if(arr[left]!=arr[right]||arr[left]>arr[left+1]){
                return false;
            }
            left++;
            right--;
        }
        return true;
    }
}
